<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Figures Template</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Figures Template' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../extensions.html">Kits</a></li><li><a href="index.html">WorldModelKit</a></li><li><b>Figures Template</b></li></ul></div>
<p class="purpose">To display figures and play sound effects.</p>

<ul class="toc"><li><a href="fgtm.html#SP1">&#167;1. Resource Usage</a></li><li><a href="fgtm.html#SP2">&#167;2. Figures</a></li><li><a href="fgtm.html#SP3">&#167;3. Sound Effects</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Resource Usage.</b>We record whether pictures or sounds have been used before by storing
single byte flags in the following array. (The extra 5 values allow for the
fact that it can be legal to use low undeclared sound effect resource
numbers in the Z-machine for short beeps, though this is deprecated in I7.)
</p>

<p class="commentary">Pictures and sounds are identified within blorb archives by resource ID
numbers which count upwards from 1 in order of creation, but can mix
pictures and sounds freely. (For instance, 1 might be a picture, 2 and 3
sound effects, then 4 a picture again, etc.) ID number 1 is in fact always
a picture: it means the cover art, and is the I6 representation of the
value "figure of cover".
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Array</span><span class="plain-syntax"> </span><span class="identifier-syntax">ResourceUsageFlags</span><span class="plain-syntax"> -&gt; (</span><span class="identifier-syntax">ICOUNT_FIGURE_NAME</span><span class="plain-syntax"> + </span><span class="identifier-syntax">ICOUNT_SOUND_NAME</span><span class="plain-syntax"> + </span><span class="constant-syntax">5</span><span class="plain-syntax">);</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Figures.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">DisplayFigure</span><span class="plain-syntax"> </span><span class="identifier-syntax">resource_ID</span><span class="plain-syntax"> </span><span class="identifier-syntax">one_time</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">one_time</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">ResourceUsageFlags</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">resource_ID</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ResourceUsageFlags</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">resource_ID</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^"</span><span class="plain-syntax">; </span><span class="identifier-syntax">VM_Picture</span><span class="plain-syntax">(</span><span class="identifier-syntax">resource_ID</span><span class="plain-syntax">); </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. Sound Effects.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">PlaySound</span><span class="plain-syntax"> </span><span class="identifier-syntax">resource_ID</span><span class="plain-syntax"> </span><span class="identifier-syntax">one_time</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">resource_ID</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">; </span><span class="comment-syntax">The "silence" non-sound effect</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">one_time</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">ResourceUsageFlags</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">resource_ID</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ResourceUsageFlags</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">resource_ID</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM_SoundEffect</span><span class="plain-syntax">(</span><span class="identifier-syntax">resource_ID</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="actm.html">&#10094;</a></li><li class="progresssection"><a href="mstm.html">mstm</a></li><li class="progresssection"><a href="sttm.html">sttm</a></li><li class="progresssection"><a href="lgtm.html">lgtm</a></li><li class="progresssection"><a href="lstm.html">lstm</a></li><li class="progresssection"><a href="ortm.html">ortm</a></li><li class="progresssection"><a href="actm.html">actm</a></li><li class="progresscurrent">fgtm</li><li class="progresssection"><a href="ottm.html">ottm</a></li><li class="progresssection"><a href="prtm.html">prtm</a></li><li class="progresssection"><a href="wrtm.html">wrtm</a></li><li class="progresssection"><a href="mprtf.html">mprtf</a></li><li class="progresssection"><a href="tmtmp.html">tmtmp</a></li><li class="progresssection"><a href="tstm.html">tstm</a></li><li class="progresssection"><a href="chtm.html">chtm</a></li><li class="progresssection"><a href="strdc.html">strdc</a></li><li class="progressnext"><a href="ottm.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

